/*
 * Обработка пунктов главного меню
 */

package mops.menu.items;

import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.control.Dialogs;
import javafx.scene.control.Dialogs.DialogOptions;
import javafx.scene.control.Dialogs.DialogResponse;
import javafx.stage.Stage;
import mops.commons.Commons;
import mops.view.window.country.CountryWindow;

/**
 *
 * @author Жук Александр
 */
public class ItemsAction {
  
    //Параметры
    public static EventHandler<ActionEvent> OnOptionsAction(final Stage aStage){
       EventHandler evHandler = new EventHandler<ActionEvent>()
       {
        @Override 
        public void handle(ActionEvent e)
        {
        Dialogs.showInformationDialog(aStage, e.getSource().toString(),
          Commons.INFO_MSG, Commons.MAIN_APP_NAME);
        }
       }; 
        return evHandler;
    }
    
    //Выход
    public static EventHandler<ActionEvent> OnExitAction(final Stage aStage){
       EventHandler evHandler = new EventHandler<ActionEvent>()
       {
        @Override 
        public void handle(ActionEvent e)
        {  
        DialogResponse response = Dialogs.showConfirmDialog(aStage, Commons.MENU_APPLICATION_EXIT_ACTION_TEXT,
         Commons.QUESTION_MSG, Commons.MAIN_APP_NAME, DialogOptions.YES_NO);
        if (response==DialogResponse.YES)
         aStage.close();
        }
       }; 
        return evHandler;
    }
    
     //Справка
    public static EventHandler<ActionEvent> OnHelpAction(final Stage aStage){
       EventHandler evHandler = new EventHandler<ActionEvent>()
       {
        @Override 
        public void handle(ActionEvent e)
        {
        Dialogs.showInformationDialog(aStage, e.getSource().toString(),
          Commons.INFO_MSG, Commons.MAIN_APP_NAME);
        }
       }; 
        return evHandler;
    }
    
     //О программе
    public static EventHandler<ActionEvent> OnAboutAction(final Stage aStage){
       EventHandler evHandler = new EventHandler<ActionEvent>()
       {
        @Override 
        public void handle(ActionEvent e)
        {
        Dialogs.showInformationDialog(aStage, e.getSource().toString(),
          Commons.INFO_MSG, Commons.MAIN_APP_NAME);
        }
       }; 
        return evHandler;
    }
    
    //MMSI по принадлежности
    public static EventHandler<ActionEvent> OnMMSIAction(final Stage aStage){
       EventHandler evHandler = new EventHandler<ActionEvent>()
       {
        @Override 
        public void handle(ActionEvent e)
        {
        Dialogs.showInformationDialog(aStage, e.getSource().toString(),
          Commons.INFO_MSG, Commons.MAIN_APP_NAME);
        }
       }; 
        return evHandler;
    }
    
           
    //Страны
    public static EventHandler<ActionEvent> OnCountryAction(final Stage aStage){
       EventHandler evHandler = new EventHandler<ActionEvent>()
       {             
        @Override 
        public void handle(ActionEvent e)
        {
            //Создаем и показываем окно справочника Страны
            CountryWindow countryWindow = new CountryWindow(aStage);         
        }
       }; 
        return evHandler;
    }
    
     //Операторы
    public static EventHandler<ActionEvent> OnOperAction(final Stage aStage){
       EventHandler evHandler = new EventHandler<ActionEvent>()
       {
        @Override 
        public void handle(ActionEvent e)
        {
        Dialogs.showInformationDialog(aStage, e.getSource().toString(),
          Commons.INFO_MSG, Commons.MAIN_APP_NAME);
        }
       }; 
        return evHandler;
    }
    
}
